const get='get';
const post='post';
import Mock from 'mockjs'
import { prefix } from '@/api/api'
import { JsonExcludeNullOrUndefind } from '@/utils/utils';
/**
 * 用户登录
 */
Mock.mock(prefix+'/login',post,(customer)=>{
    // console.log('用户登录')
  customer=JSON.parse(customer.body).customer
// console.log(customer.name)
     customer={
        id:Mock.mock('@id'),
        name:customer.name,  //用户名
        password:Mock.mock('@word(16)'),
        nickname:customer.name+' 的昵称',
        // phone:Mock.mock('@phone'),
        address:[
            Mock.mock('@county(true)'),
            Mock.mock('@county(true)'),
            Mock.mock('@county(true)'),
            Mock.mock('@county(true)'),
            Mock.mock('@county(true)'),
        ]
    }
    let account={
            // 登录时间
            time:Mock.mock('@datetime("yyyy-MM-dd HH:mm:ss")'),
            ip:Mock.mock('@ip'),//登录ip
            token:Mock.mock('@word(16)'),//token
    }
    let data={
        customer,
        account
    }
    let res={
        'data':data,
        code:200,
        msg:'',
    }
    // console.log(res);
   
    return res;
})
Mock.mock(prefix+'/isrememberLogin',post,(dd)=>{
    // console.log(JSON.parse(dd.body));
    let customer={
        id:Mock.mock('@id'),
        name:Mock.mock('@cname'),
        password:Mock.mock('@word(16)'),
        nickname:Mock.mock('@name'),
        // phone:Mock.mock('@phone'),
        address:[
            Mock.mock('@county(true)'),
            Mock.mock('@county(true)'),
            Mock.mock('@county(true)'),
            Mock.mock('@county(true)'),
            Mock.mock('@county(true)'),
        ]
    }
    let account={
            // 登录时间
            time:Mock.mock('@datetime("yyyy-MM-dd HH:mm:ss")'),
            ip:Mock.mock('@ip'),//登录ip
            token:Mock.mock('@word(16)'),//token
    }
    return {
        data:{customer,account},
        code:200,
        msg:'未修改用户信息'
    }
})
